import request from '@/utils/request'

// 查询采购申请列表
export function listBuyReq(query) {
  return request({
    url: '/caigou/buyReq/list',
    method: 'get',
    params: query
  })
}

// 查询采购申请详细
export function getBuyReq(id) {
  return request({
    url: '/caigou/buyReq/' + id,
    method: 'get'
  })
}

// 查询采购申请详细
export function getBuyReqPlus(id) {
  return request({
    url: '/caigou/buyReq/info/' + id,
    method: 'get'
  })
}

export function getInfoListByIds(ids){
  return request({
    url:'/caigou/buyReq/getInfoListByIds',
    method: 'post',
    data:ids
  })
}
export function getGoodsListByBuyReqIds(ids){
  return request({
    url:'/caigou/buyReq/getGoodsListByBuyReqIds',
    method: 'post',
    data:ids
  })
}
// 新增采购申请
export function addBuyReq(data) {
  return request({
    url: '/caigou/buyReq',
    method: 'post',
    data: data
  })
}
// 新增采购申请PLUS
//{
//     "buyReqDataBase":{
//         "id":1212,
//         "code":"CGSQ-aadad1231"
//     },
//     "idAndNumberList":[
//         {"id":12,"number":"1221"},
//         {"id":89,"number":"689"}
//     ]
// }
export function addBuyReqPlus(data) {
  return request({
    url: '/caigou/buyReq/addPlus',
    method: 'post',
    data: data
  })
}

// 修改采购申请
export function updateBuyReq(data) {
  return request({
    url: '/caigou/buyReq',
    method: 'put',
    data: data
  })
}

export function updateBuyReqPlus(data) {
  return request({
    url: '/caigou/buyReq/editPlus',
    method: 'put',
    data: data
  })
}

// 删除采购申请
export function delBuyReq(id) {
  return request({
    url: '/caigou/buyReq/' + id,
    method: 'delete'
  })
}

export function delBuyReqPlus(id) {
  return request({
    url: '/caigou/buyReq/removePlus/' + id,
    method: 'delete'
  })
}
